<?php 
function navigation($_menu)
{
	global $db,$webdir,$webhtmldir,$webmode;
	$id=$_GET['id'];
	if($_menu==1)
	{
		$db->query("SELECT * FROM tun2_columns where bid=0 and hide=0 Order by columnswith desc,id asc");
		$class_array = array();
		$i=0;
		$class_array[] = array(
		'classname'  => "首页",
		'num'  => $i=1,
		'classurl'  => $webdir
		);
	}elseif($_menu==2)
	{
		$result = mysql_query("SELECT * FROM tun2_columns where bid=".$id." ");
		$row = mysql_fetch_array($result);
		if(empty($row[0]))
		{
			$strSql="SELECT * FROM tun2_columns where id=".$id."";
			$db->query($strSql);
			if($db->next_record())
			{
				$bid  = $db->Record["bid"];
			}
			$db->query("SELECT * FROM tun2_columns where bid=".$bid." and hide=0 Order by columnswith desc,id asc");
			$class_array = array();
			$i=0;
		}
		else
		{
			$db->query("SELECT * FROM tun2_columns where bid=".$id." and hide=0 Order by columnswith desc,id asc");
			$class_array = array();
			$i=0;
		}
	}
	elseif($_menu==3)
	{
		$db->query("SELECT * FROM tun2_content where id=".$_GET['id']." ");
		$class_array = array();
		$i=0;
		while($db->next_record())
		{$class_array[] = array(
		$classid=$db->Record["columnsname"]
		);
		}
		$db->query("SELECT * FROM tun2_columns where id=".$classid." and hide=0 Order by columnswith desc,id asc");
		$class_array = array();
		$i=0;
		while($db->next_record())
		{$class_array[] = array(
		$classbid=$db->Record["bid"]
		);
		}
		$db->query("SELECT * FROM tun2_columns where bid=".$classbid." and hide=0 Order by columnswith desc,id asc");
		$class_array = array();
		$i=0;
		$class_array = array();
	}
	while($db->next_record())
	{$class_array[] = array(
	'classname'  => $db->Record["columnsname"],
	'num'  => $i+=1,
	'classurl'  => classlink($db->Record["id"])
	);
	}
	return $class_array;
	unset($class_array);
}

function columnsname($_columnsname)
{
	global $db,$webdir,$webhtmldir,$webmode;
	$db->query("SELECT * FROM tun2_columns where bid=".$_columnsname." and hide=0 Order by columnswith desc,id asc");
	$class_array = array();
	$i=0;
	while($db->next_record())
	{$class_array[] = array(
	'classname' 	=> $db->Record["columnsname"],
	'num' 			=> $i+=1,
	'classurl' 		=> classlink($db->Record["id"])
	);
	}
	return $class_array;
	unset($class_array);
}
function classurl($_classid)
{
	global $webdir,$webhtmldir,$webmode;
	if($webmode=="php")
	$classurl=$webdir."class.php?id=".$_classid;
	else
	$classurl=$webdir.$webhtmldir."class_".$_classid.".".$webmode;
	echo $classurl;

}
function single($id)
{
	global $db,$webdir,$webhtmldir,$webmode;
	$db->query("SELECT * FROM tun2_columns where id=(".$id.")");
	$class_array = array();
	while($db->next_record())
	{$class_array[] = array(
	'title' 	=> $db->Record["columnsname"],
	'url' 		=> classlink($db->Record["id"]),
	'content' 	=> $db->Record["content"]
	);
	}

	return $class_array;
	unset($class_array);
}

function columns($id,$num,$State,$Sorting,$Sequence)
{
	global $db,$upfile,$webdir;
	$strSql="SELECT * FROM tun2_content";
	if($id!=""){
		$strSql.=" WHERE columnsname in (".$id.")";
		if($State!="" or $State!=0)
		$strSql.=" and";
	}
	else{
		if($State!="" or $State!=0)
		$strSql.=" WHERE";
	}
	switch ($State){
		case 1:
			$strSql.=" rec=1";
			break;
		case 2:
			$strSql.=" hot=1";
			break;
	}
	switch ($Sorting){
		case 1:
			$strSql.=" Order by id";
			break;
		case 2:
			$strSql.=" Order by addtime";
			break;
		case 3:
			$strSql.=" Order by hits";
			break;
	}
	switch ($Sequence){
		case 1:
			$strSql.=" desc";
			break;
		case 2:
			$strSql.=" asc";
			break;
	}
	if($num!=""){
		$strSql.=" limit 0,".$num;
	}
	$db->query($strSql);
	$tun2_array = array();
	$i=0;
	$UpdatedTo=explode("\r",$db->Record["datalist"]);
	while($db->next_record())
	{
		$tun2_array[] = array(
		'title'     	=> $db->Record["title"],
		'alt'        	=> uh($db->Record["title"]),
		'columnsname' 	=> namezh("tun2_columns","columnsname",$db->Record["columnsname"]),
		'columnsurl' 	=> classlink($db->Record["columnsname"]),
		'actor' 	    => str_replace("|"," ",$db->Record["actor"]),
		'photo'  		=> tun2pic($db->Record["photo"]),
		'content'   	=> $db->Record["content"],
		'date'      	=> substr($db->Record["addtime"],0,10),
		'hits' 	        => $db->Record["hits"],
		'num'			=> $i+=1,
		'url'		    => tun2link($db->Record["id"],$db->Record["addtime"]),
		'size'          => module("products","size",$db->Record["id"]),
		'price'         => module("products","price",$db->Record["id"]),
		'experience'    => module("hr","experience",$db->Record["id"]),
		'nature'        => module("hr","nature",$db->Record["id"]),
		'education'     => module("hr","education",$db->Record["id"]),
		'amount'        => module("hr","amount",$db->Record["id"]),
		'pay'           => module("hr","pay",$db->Record["id"]),
		'downloadtitle' => module("download","title",$db->Record["id"]),
		'downloadurl'   => module("download","url",$db->Record["id"])
		);
	}
	return $tun2_array;
	unset($tun2_array);
}

function notice($num)
{
	global $db,$webdir;
	$db->query("SELECT * FROM tun2_notice Order by id desc limit 0,".$num);
	$notice_array = array();
	while($db->next_record())
	{
		//把结果存成二维数组
		$notice_array[] = array(
		'title' 		=> $db->Record["title"],
		'content' => $db->Record["content"],
		'url'		=> $webdir."notice.php?id=".$db->Record["id"],
		'date' 	=> substr($db->Record["time"],0,10)
		);
	}
	return $notice_array;
	unset($notice_array);
}

function links($num,$type)
{
	global $db;
	$db->query("SELECT * FROM tun2_links where type=".$type." Order by id desc limit 0,".$num);
	$links_array = array();
	while($db->next_record())
	{
		//把结果存成二维数组
		$links_array[] = array(
		'linksname' 	=> $db->Record["linkname"],
		'linkspic' 		=> @$db->Record["images"],
		'linkshref' 	=> $db->Record["address"],
		'linksction' 	=> $db->Record["introduction"]
		);
	}
	return $links_array;
	unset($links_array);
}

function cnsubstr($str_cut,$length)//截字符串长度
{
	if (strlen($str_cut) > $length)
	{
		for($i=0; $i < $length; $i++)
		if (ord($str_cut[$i]) > 128)    $i++;
		$str_cut = substr($str_cut,0,$i);
	}
	return $str_cut;
}

function namezh($tables,$tablesname,$id)
{
	global $db1;
	$db1->query("SELECT $tablesname FROM $tables WHERE id='".$id."'");
	if($db1->next_record())
	{
		return $db1->Record[$tablesname];
	}
}

function module($tables,$tablesname,$id)
{
	global $db1;
	$db1->query("SELECT $tablesname FROM tun2_$tables WHERE bid='".$id."'");
	if($db1->next_record())
	{
		return $db1->Record[$tablesname];
	}
}

function classpage($num,$Sorting,$Sequence)
{
	global $db,$page,$classid,$intPerpage,$execc,$upfile,$webdir;
	function getSort($num,&$orArray){
		global $db;
		$sql = "select * from tun2_columns where bid=".$num;
		$result = $db->query($sql);
		if($result){
			$search = array();
			while($row=mysql_fetch_assoc($result)){
				$orArray[] = $row['id'];
				$search[] = $row['id'];
			}
			foreach($search as $key=>$value){
				getSort($value,$orArray);
			}
		}
	}
	$orArray[] = "";
	getSort($classid,$orArray);
	$or = implode(" or columnsname=",$orArray);
	$intPerpage=$num;
	if (isset($page)) {
		$offset = ($page -1)*$num;
	}
	else {
		$offset = 0;
	}
	$execc="SELECT id FROM tun2_content WHERE columnsname =$classid $or";
	$strSql="SELECT * FROM tun2_content WHERE columnsname =$classid $or";
	switch ($Sorting){
		case 1:
			$strSql.=" Order by sequence DESC, id";
			break;
		case 2:
			$strSql.=" Order by sequence DESC, addtime";
			break;
		case 3:
			$strSql.=" Order by sequence DESC, hits";
			break;
	}
	switch ($Sequence){
		case 1:
			$strSql.=" desc";
			break;
		case 2:
			$strSql.=" asc";
			break;
	}
	$strSql.=" limit $offset,$num";
	$db->query($strSql);
	$tun2_array = array();
	$i=0;
	while($db->next_record())
	{
		$tun2_array[]      = array(
		'id' 	        => $db->Record["id"],
		'title' 	    => $db->Record["title"],
		'alt' 	        => $db->Record["alt"],
		'columnsname' 	=> namezh("tun2_columns","columnsname",$db->Record["columnsname"]),
		'columnsurl' 	=> classlink($db->Record["columnsname"]),
		'actor' 	    => str_replace("|"," ",$db->Record["actor"]),
		'photo'		    => tun2pic($db->Record["photo"]),
		'content' 	    => uh($db->Record["content"]),
		'date'       	=> substr($db->Record["addtime"],0,10),
		'hits'      	=> $db->Record["hits"],
		'num'			=> $i+=1,
		'url' 		    => tun2link($db->Record["id"],$db->Record["addtime"]),
		'size'          => module("products","size",$db->Record["id"]),
		'price'         => module("products","price",$db->Record["id"]),
		'experience'    => module("hr","experience",$db->Record["id"]),
		'nature'        => module("hr","nature",$db->Record["id"]),
		'education'     => module("hr","education",$db->Record["id"]),
		'amount'        => module("hr","amount",$db->Record["id"]),
		'pay'           => module("hr","pay",$db->Record["id"]),
		'downloadtitle' => module("download","title",$db->Record["id"]),
		'downloadurl'   => module("download","url",$db->Record["id"])
		);
	}
	return $tun2_array;
	unset($tun2_array);
}

function gust($name)
{
	if($name=="")
	{return "匿名网友";}
	else
	{return $name;}
}

function reply($reply)
{
	if($reply=="")
	{return "暂时还没有回复。";}
	else
	{return $reply;}
}

function hideIP($str) {
	$str = preg_replace('/(\d+)\.(\d+)\.(\d+)\.(\d+)/is',"$1.$2.*.*",$str);
	return $str;
}

function book($num,$Sorting,$Sequence)
{
	global $db,$page,$classid,$intPerpage,$execc,$upfile,$webdir;
	$intPerpage=$num;
	if (isset($page)) {
		$offset = ($page -1)*$num;
	}
	else {
		$offset = 0;
	}
	$execc="SELECT id FROM tun2_book where verify=1";
	$strSql="SELECT * FROM tun2_book where verify=1";
	switch ($Sorting){
		case 1:
			$strSql.=" Order by  id";
			break;
		case 2:
			$strSql.=" Order by  time";
			break;
	}
	switch ($Sequence){
		case 1:
			$strSql.=" desc";
			break;
		case 2:
			$strSql.=" asc";
			break;
	}
	$strSql.=" limit $offset,$num";
	$db->query($strSql);
	$tun2_array = array();
	$i=0;
	while($db->next_record())
	{
		$tun2_array[]       = array(
		'id' 	        => $db->Record["id"],
		'name' 	        => gust($db->Record["name"]),
		'contact' 	    => $db->Record["contact"],
		'content' 	    => $db->Record["content"],
		'ip' 	        => hideIP($db->Record["ip"]),
		'time' 	        => $db->Record["time"],
		'reply' 	    => reply($db->Record["reply"]),
		);
	}
	return $tun2_array;
	unset($tun2_array);
}

function search($num,$Sorting,$Sequence)
{
	global $db,$page,$keyword,$Type,$intPerpage,$execc,$upfile,$webdir;
	$intPerpage=$num;
	if (isset($page)) {
		$offset = ($page -1)*$num;
	}
	else {
		$offset = 0;
	}
	$execc="SELECT id FROM tun2_content WHERE title like '%$keyword%' or actor like '%$keyword%' or content like '%$keyword%'";
	$strSql="SELECT * FROM tun2_content WHERE title like '%$keyword%' or actor like '%$keyword%' or content like '%$keyword%' ";
	switch ($Sorting){
		case 1:
			$strSql.=" Order by sequence DESC, id";
			break;
		case 2:
			$strSql.=" Order by sequence DESC, addtime";
			break;
		case 3:
			$strSql.=" Order by sequence DESC, hits";
			break;
	}
	switch ($Sequence){
		case 1:
			$strSql.=" desc";
			break;
		case 2:
			$strSql.=" asc";
			break;
	}
	$strSql.=" limit $offset,$num";
	$db->query($strSql);
	$tun2_array = array();
	$i=0;
	while($db->next_record())
	{
		$tun2_array[]      = array(
		'id' 	        => $db->Record["id"],
		'title' 	    => $db->Record["title"],
		'alt' 	        => $db->Record["alt"],
		'columnsname' 	=> namezh("tun2_columns","columnsname",$db->Record["columnsname"]),
		'columnsurl' 	=> classlink($db->Record["columnsname"]),
		'actor' 	    => str_replace("|"," ",$db->Record["actor"]),
		'photo'		    => tun2pic($db->Record["photo"]),
		'content' 	    => uh($db->Record["content"]),
		'date'       	=> substr($db->Record["addtime"],0,10),
		'hits'      	=> $db->Record["hits"],
		'num'			=> $i+=1,
		'url' 		    => tun2link($db->Record["id"],$db->Record["addtime"]),
		'size'          => module("products","size",$db->Record["id"]),
		'price'         => module("products","price",$db->Record["id"]),
		'experience'    => module("hr","experience",$db->Record["id"]),
		'nature'        => module("hr","nature",$db->Record["id"]),
		'education'     => module("hr","education",$db->Record["id"]),
		'amount'        => module("hr","amount",$db->Record["id"]),
		'pay'           => module("hr","pay",$db->Record["id"]),
		'downloadtitle' => module("download","title",$db->Record["id"]),
		'downloadurl'   => module("download","url",$db->Record["id"])
		);
	}
	return $tun2_array;
	unset($tun2_array);

}

function showpage($mode,$style,$nowindex_style)
{
	global $intPerpage,$intNum,$classid,$execc,$webmode,$webhtmldir,$webdir,$keyword;
	$resultc=mysql_query($execc);
	$intNum=mysql_num_rows($resultc);
	if($webmode=="php" || isset($keyword)){
		$page=new page(array('total'=>$intNum,'perpage'=>$intPerpage));
	}else{
		$page=new page(array('total'=>$intNum,'perpage'=>$intPerpage,'url'=>$webdir.$webhtmldir."class_".$classid));
		$page->page_webmode = $webmode;
	}
	return $page->show($mode,$style,$nowindex_style);
}


function classlink($id)
{
	global $webdir,$webhtmldir,$webmode;
	if($webmode=="php")
	$classurl=$webdir."class.php?id=".$id;
	else
	$classurl=$webdir.$webhtmldir."class_".$id.".".$webmode;
	return $classurl;
}

function actorlink($actor)
{
	global $webdir;
	$tun2actor="";
	$mactor=explode("|",$actor);
	for($i=0; $i<count($mactor); $i++)
	{$tun2actor.="<a href=\"".$webdir."search.php?keyword=".$mactor[$i]."\" title=\"".$mactor[$i]."\">".$mactor[$i]."</a> ";}
	return $tun2actor;
}

function tun2pic($pic)
{
	global $webdir,$upfile;
	if(stristr($pic,strtolower("http://"))){
		return $pic;
	}else{
		return $webdir.$upfile.$pic;
	}
}

function tun2link($id,$addtime)
{
	global $webhtmlname,$webdir,$webhtmldir,$webmode;
	if($webmode=="php"){
		$tun2url=$webdir."view.php?id=".$id;
	}
	else{
		switch ($webhtmlname){
			case 1:
				$tun2url=$webdir.$webhtmldir."view_".$id.".".$webmode;
				break;
			case 2:
				$tun2url=$webdir.$webhtmldir.date("Ymdgis",strtotime($addtime)).".".$webmode;
				break;
			case 3:
				$tun2url=$webdir.$webhtmldir.$id."/";
				break;
		}
	}
	return $tun2url;
}

function Location($TemplateType,$_id)
{
	function get_path($node){
		global $webdir,$webhtmldir,$webmode;
		$result=mysql_query('select * from tun2_columns where id='.$node.' ');
		$row=mysql_fetch_array($result);
		$path=array();
		if($webmode=="php")
		{
			$classurl=$webdir."class.php?id=".$row['id'];
		}
		else
		{
			$classurl=$webdir.$webhtmldir."class_".$row['id'].".".$webmode;
		}
		if($row['bid']!=''){
			$path[]="<a href=".$classurl." alt=".$row['columnsname']."/>".$row['columnsname']."</a>>";
			$path=array_merge(get_path($row['bid']),$path);
		}
		return $path;
	}
	if($TemplateType=="class"){
		foreach(get_path($_id) as $path){
			$newpath.=$path;
		}
		return "<a href=\"".$webdir."\" alt=\"".$web_name."\">首页</a>>".$newpath."";
	}else if($TemplateType=="view"){
		foreach(get_path($_id) as $path){
			$newpath.=$path;
		}
		return "<a href=\"".$webdir."\" alt=\"".$web_name."\">首页</a>>".$newpath."";
	}
	switch ($TemplateType){
		case "index":
			return "<a href=\"".$webdir."\">首页</a>>";
			break;
		case "class":
			return $echoloction;
			break;
		case "search":
			return "<a href=\"".$webdir."\">首页</a>><a>网站搜索</a>>";
			break;
		case "view":
			return $echoloction;
			break;
		case "notice":
			return "<a href=\"".$webdir."\">首页</a>><a>站内公告</a>>";
			break;
	}
}


function template($file)
{
	global $tpl_default_dir,$t;
	$str=$t->tpl_read($tpl_default_dir."/".$file);
	$str=$t->tpl_parse($str);
	$tpldir=str_replace(".htm","",$tpl_default_dir.".tpl/".$file.".tpl.php");
	$t->tpl_write($tpldir,$str);
	return $tpldir;
}

function flash($Style,$Slidewidth,$Slideheight)
{
	global $db,$webdir;
	$pic="";$links="";$texts="";$i=0;
	switch ($Style){
		case 1:
			$FlashSlide="<script type=\"text/javascript\">\n".
			"var focus_width=".$Slidewidth."\n".
			"var focus_height=".$Slideheight."\n".
			"var text_height=0\n".
			"var swf_height = focus_height+text_height\n";
			$db->query("SELECT * FROM tun2_slide Order by swith desc");
			while($db->next_record())
			{
				if(stristr($db->Record["images"],strtolower("http://"))){
					$images=$db->Record["images"];
				}else{
					$images=$webdir.$db->Record["images"];
				}
				$i++;
				$FlashSlide.="imgUrl$i=\"".$images."\";\n";
				$FlashSlide.="imgtext$i=\"".$db->Record["name"]."\";\n";
				$FlashSlide.="imgLink$i=escape(\"".$db->Record["address"]."\");\n";
				$pic.="imgUrl$i+\"|\"+";
				$links.="imgLink$i+\"|\"+";
				$texts.="imgtext$i+\"|\"+";
			}
			$FlashSlide.="var pics=".rtrim($pic,"+\"|\"+")."\n".
			"var links=".rtrim($links,"+\"|\"+")."\n".
			"var texts=".rtrim($texts,"+\"|\"+")."\n".
			"document.write('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\"'+ focus_width +'\" height=\"'+ swf_height +'\">');\n".
			"document.write('<param name=\"allowScriptAccess\" value=\"sameDomain\"><param name=\"movie\" value=\"".$webdir."FlashSlide/Style".$Style."/flash.swf\"><param name=\"quality\" value=\"high\"><param name=\"bgcolor\" value=\"#F0F0F0\">');\n".
			"document.write('<param name=\"menu\" value=\"false\"><param name=wmode value=\"opaque\">');".
			"document.write('<param name=\"FlashVars\" value=\"pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'\">');\n".
			"document.write('<embed src=\"".$webdir."FlashSlide/Style".$Style."/flash.swf\" wmode=\"opaque\" FlashVars=\"pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'\" menu=\"false\" bgcolor=\"#F0F0F0\" quality=\"high\" width=\"'+ focus_width +'\" height=\"'+ focus_height +'\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />');  document.write('</object>');\n".
			"</script>";
			break;
		case 2:
			$db->query("SELECT * FROM tun2_slide Order by swith desc");
			while($db->next_record())
			{
				if(stristr($db->Record["images"],strtolower("http://"))){
					$images=$db->Record["images"];
				}else{
					$images=$webdir.$db->Record["images"];
				}
				$pic.="'".$images."',";
				$texts.="'".$db->Record["name"]."',";
				$links.="'".$db->Record["address"]."',";
			}
			$FlashSlide="<DIV style=\" OVERFLOW: hidden; WIDTH: $Slidewidth px; HEIGHT: $Slideheight px\"><SCRIPT language=JavaScript src=\"".$webdir."FlashSlide/Style".$Style."/slideshow.js\" type=text/javascript></SCRIPT>\n".
			"<SCRIPT language=JavaScript type=text/javascript>\n".
			"var mySlideList = [".rtrim($pic,",")."];\n".
			"var myAltList = [".rtrim($texts,",")."];\n".
			"var myLinkList = [".rtrim($links,",")."];\n".
			"var mySlideShow = new SlideShowSize(mySlideList,myAltList,myLinkList,'imgUnit',5000, 'mySlideShow',$Slidewidth,$Slideheight,0,800,600);\n".
			"mySlideShow.init();\n".
			"mySlideShow.play();\n".
			"</SCRIPT></DIV>";
			break;
		case 3:
			$FlashSlide="<script type=text/javascript>".
			"var pic_width=$Slidewidth;\n".
			"var pic_height=$Slideheight;\n".
			"var button_pos=4;\n".
			"var stop_time=3000;\n".
			"var show_text=0;\n".
			"var txtcolor=\"000000\";\n".
			"var bgcolor=\"DDDDDD\";\n".
			"var imag=new Array();\n".
			"var link=new Array();\n".
			"var text=new Array();\n";
			$db->query("SELECT * FROM tun2_slide Order by swith desc");
			while($db->next_record())
			{
				if(stristr($db->Record["images"],strtolower("http://"))){
					$images=$db->Record["images"];
				}else{
					$images=$webdir.$db->Record["images"];
				}
				$i++;
				$FlashSlide.="imag[$i]=\"".$images."\";\n";
				$FlashSlide.="text[$i]=\"".$db->Record["name"]."\";\n";
				$FlashSlide.="link[$i]=\"".$db->Record["address"]."\";\n";
			}
			$FlashSlide.="var swf_height=show_text==1?pic_height+20:pic_height;\n".
			"var pics=\"\", links=\"\", texts=\"\";\n".
			"for(var i=1; i<imag.length; i++){\n".
			"pics=pics+(\"|\"+imag[i]);\n".
			"links=links+(\"|\"+link[i]);\n".
			"texts=texts+(\"|\"+text[i]);\n".
			"}\n".
			"pics=pics.substring(1);\n".
			"links=links.substring(1);\n".
			"texts=texts.substring(1);\n".
			"document.write('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cabversion=6,0,0,0\" width=\"'+ pic_width +'\" height=\"'+ swf_height +'\">');\n".
			"document.write('<param name=\"movie\" value=\"".$webdir."FlashSlide/Style".$Style."/Flash.swf\">');\n".
			"document.write('<param name=\"quality\" value=\"high\"><param name=\"wmode\" value=\"opaque\">');\n".
			"document.write('<param name=\"FlashVars\" value=\"pics='+pics+'&links='+links+'&texts='+texts+'&pic_width='+pic_width+'&pic_height='+pic_height+'&show_text='+show_text+'&txtcolor='+txtcolor+'&bgcolor='+bgcolor+'&button_pos='+button_pos+'&stop_time='+stop_time+'\">');\n".
			"document.write('<embed src=\"".$webdir."FlashSlide/Style".$Style."/Flash.swf\" FlashVars=\"pics='+pics+'&links='+links+'&texts='+texts+'&pic_width='+pic_width+'&pic_height='+pic_height+'&show_text='+show_text+'&txtcolor='+txtcolor+'&bgcolor='+bgcolor+'&button_pos='+button_pos+'&stop_time='+stop_time+'\" quality=\"high\" width=\"'+ pic_width +'\" height=\"'+ swf_height +'\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />');\n".
			"document.write('</object>');\n".
			"</script>";
			break;
		case 4:
			$FlashSlide="<script type=text/javascript>\n".
			"var swf_width=$Slidewidth \n".
			"var swf_height=$Slideheight \n";
			$db->query("SELECT * FROM tun2_slide Order by swith desc");
			while($db->next_record())
			{
				if(stristr($db->Record["images"],strtolower("http://"))){
					$images=$db->Record["images"];
				}else{
					$images=$webdir.$db->Record["images"];
				}
				$i++;
				$pic.=$images."|";
				$links.=$db->Record["address"]."|";
			}
			$FlashSlide.="var files='".rtrim($pic,"|")."'\n".
			"var links='".rtrim($links,"|")."'\n".
			"var texts=''\n".
			"document.write('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\"'+ swf_width +'\" height=\"'+ swf_height +'\">');\n".
			"document.write('<param name=\"movie\" value=\"".$webdir."FlashSlide/Style".$Style."/Flash.swf\"><param name=\"quality\" value=\"high\">');\n".
			"document.write('<param name=\"menu\" value=\"false\"><param name=wmode value=\"opaque\">');\n".
			"document.write('<param name=\"FlashVars\" value=\"bcastr_file='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'\">');\n".
			"document.write('<embed src=\"".$webdir."FlashSlide/Style".$Style."/Flash.swf\" wmode=\"opaque\" FlashVars=\"bcastr_file='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'&menu=\"false\"\" quality=\"high\" width=\"'+ swf_width +'\" height=\"'+ swf_height +'\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />'); document.write('</object>');\n".
			"</script>";
			break;
	}
	return $FlashSlide;
}
?>